package com.nmc.service.manager.impl;

import java.util.List;

import org.springframework.security.authentication.encoding.PasswordEncoder;

import com.nmc.service.dao.HospitalDao;
import com.nmc.service.manager.HospitalManager;
import com.nmc.service.model.Hospital;

/**
 * Implementation of HospitalManager interface.
 * 
 * @author <a href="mailto:matt@raibledesigns.com">Matt Raible</a>
 */
public class HospitalManagerImpl extends GenericManagerImpl<Hospital, Long> implements
		HospitalManager {

	private HospitalDao hospitalDao;


	public void setHospitalDao(HospitalDao hospitalDao) {
		this.dao = hospitalDao;
		this.hospitalDao = hospitalDao;
	}

	/**
	 * {@inheritDoc}
	 */
	public Hospital getHospital(String hospitalId) {
		return hospitalDao.get(new Long(hospitalId));
	}

	/**
	 * {@inheritDoc}
	 */
	public List<Hospital> getHospitals() {
		return hospitalDao.getAllDistinct();
	}

	/**
	 * {@inheritDoc}
	 */
	public Hospital saveHospital(Hospital hospital) {

		return hospitalDao.saveHospital(hospital);

	}

	/**
	 * {@inheritDoc}
	 */
	public void removeHospital(String hospitalId) {
		log.debug("removing hospital: " + hospitalId);
		hospitalDao.remove(new Long(hospitalId));
	}

	/**
	 * {@inheritDoc}
	 */
	public List<Hospital> search(String searchTerm) {
		return super.search(searchTerm, Hospital.class);
	}
	
	public List<Hospital> searchHospital(int zoneId,String query){
		
		return hospitalDao.searchHospital(zoneId,query);
	}
}
